package com.css.fxfzypg.modules.suggestinfo.analysis.suggestionanalysis.service.impl;

import cn.hutool.core.util.IdUtil;
import com.css.fxfzypg.constants.YNEnum;
import com.css.fxfzypg.modules.suggestinfo.analysis.annualrisk.repository.entity.AnnualRiskEntity;
import com.css.fxfzypg.modules.suggestinfo.analysis.annualrisk.service.AnnualRiskService;
import com.css.fxfzypg.modules.suggestinfo.analysis.disasterscenario.repository.entity.DisasterScenarioEntity;
import com.css.fxfzypg.modules.suggestinfo.analysis.disasterscenario.service.DisasterScenarioService;
import com.css.fxfzypg.modules.suggestinfo.analysis.emergencydisaster.repository.entity.EmergencyDisasterEntity;
import com.css.fxfzypg.modules.suggestinfo.analysis.emergencydisaster.service.EmergencyDisasterService;
import com.css.fxfzypg.modules.suggestinfo.analysis.emergencydisposal.repository.entity.EmergencyDisposalEntity;
import com.css.fxfzypg.modules.suggestinfo.analysis.emergencydisposal.service.EmergencyDisposalService;
import com.css.fxfzypg.modules.suggestinfo.analysis.suggestionanalysis.repository.SuggestionAnalysisRepository;
import com.css.fxfzypg.modules.suggestinfo.analysis.suggestionanalysis.service.SuggestionAnalysisService;
import com.css.fxfzypg.modules.suggestinfo.analysis.suggestionanalysis.vo.ParamsVo;
import com.css.fxfzypg.modules.suggestinfo.analysis.suggestionanalysis.vo.SuggestionAnalysisParams;
import com.css.fxfzypg.modules.suggestinfo.analysis.suggestionanalysis.vo.SysMenuVo;
import com.css.fxfzypg.modules.suggestinfo.manage.annualriskManage.repository.entity.AnnualRiskManageEntity;
import com.css.fxfzypg.modules.suggestinfo.manage.annualriskManage.service.AnnualRiskManageService;
import com.css.fxfzypg.modules.suggestinfo.manage.disasterscenarioManage.repository.entity.DisasterScenarioManageEntity;
import com.css.fxfzypg.modules.suggestinfo.manage.disasterscenarioManage.service.DisasterScenarioManageService;
import com.css.fxfzypg.modules.suggestinfo.manage.emergencydisasterManage.repository.entity.EmergencyDisasterManageEntity;
import com.css.fxfzypg.modules.suggestinfo.manage.emergencydisasterManage.service.EmergencyDisasterManageService;
import com.css.fxfzypg.modules.suggestinfo.manage.emergencydisposalManage.repository.entity.EmergencyDisposalManageEntity;
import com.css.fxfzypg.modules.suggestinfo.manage.emergencydisposalManage.service.EmergencyDisposalManageService;
import com.css.fxfzypg.util.CreateGson;
import com.css.fxfzypg.util.PlatformObjectUtils;
import com.css.fxfzypg.util.SpringUtil;
import com.css.fxfzypg.web.PlatformSessionContext;
import com.css.fxfzypg.zcpt.sys.service.SysAreaService;
import com.google.common.reflect.TypeToken;
import com.google.gson.Gson;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import java.io.UnsupportedEncodingException;
import java.lang.reflect.Type;
import java.net.URLEncoder;
import java.util.*;

@Service
public class SuggestionAnalysisServiceImpl implements SuggestionAnalysisService {
    @Autowired
    SuggestionAnalysisRepository suggestionAnalysisRepository;
    @Autowired
    DisasterScenarioService disasterScenarioService;
    @Autowired
    AnnualRiskService annualRiskService;
    @Autowired
    EmergencyDisasterService emergencyDisasterService;
    @Autowired
    EmergencyDisposalService emergencyDisposalService;
    @Autowired
    SysAreaService sysAreaService;
    @Autowired
    DisasterScenarioManageService disasterScenarioManageService;
    @Autowired
    AnnualRiskManageService annualRiskManageService;
    @Autowired
    EmergencyDisasterManageService emergencyDisasterManageService;
    @Autowired
    EmergencyDisposalManageService emergencyDisposalManageService;

    @Override
    public Map<String, Object> queryTaskList(SuggestionAnalysisParams queryParams, int curPage, int pageSize) {
        //获取没有子任务的父任务 + 子任务
        //权限:任务管理员  组长  小组成员参与的
        String userId = PlatformSessionContext.getUserID();
        return suggestionAnalysisRepository.queryTaskList(queryParams, curPage, pageSize, userId);
    }

    @Override
    public Map<String, Object> getDivisionByTaskDistrict(String taskNum, String taskDistrict, String suggestionName, String flag) throws UnsupportedEncodingException {
        List<ParamsVo> list = new ArrayList<>();
        List<String> areaIdList = new ArrayList<>();//当按市级会用到,放入市级相关的区县id,进行判断再给前端返回数据,否则会有该市其他区县的数据
        List<SysMenuVo> sysMenuList = getSAreaTree("1");//获取所有省
        //flag(0:按区县,1:按地市)
        if (flag.equals("0")) {
            for (String district : taskDistrict.split("、")) {
                int n = district.length() - district.replaceAll("-", "").length();
                if (district.contains("北京市") || district.contains("天津市") || district.contains("上海市") || district.contains("重庆市")) {
                    if (n == 0) {
                        for (SysMenuVo sysMenuVo : sysMenuList) {
                            String name = sysMenuVo.getName();
                            if (district.equals(name)) {
                                List<SysMenuVo> citySysMenu = getSAreaTree(sysMenuVo.getValue());//获取该省下所有市
                                for (SysMenuVo citySysMenuVo : citySysMenu) {
                                    List<SysMenuVo> areaSysMenu = getSAreaTree(citySysMenuVo.getValue());//获取市下所有区县
                                    for (SysMenuVo areaSysMenuVo : areaSysMenu) {
                                        ParamsVo paramsVo = new ParamsVo();
                                        paramsVo.setTaskNum(taskNum);
                                        paramsVo.setProvince(district);
                                        paramsVo.setProvinceId(sysMenuVo.getValue());
                                        paramsVo.setCity(citySysMenuVo.getName());
                                        paramsVo.setCityId(citySysMenuVo.getValue());
                                        paramsVo.setArea(areaSysMenuVo.getName());
                                        paramsVo.setAreaId(areaSysMenuVo.getValue());
                                        paramsVo.setFlag(flag);
                                        list.add(paramsVo);
                                    }
                                }
                            }
                        }
                    } else if (n == 1) {
                        String province = district.split("-")[0];
                        String city = district.split("-")[0];
                        String area = district.split("-")[1];
                        String divisionIds = sysAreaService.getIdByCondition(URLEncoder.encode(province, "UTF-8"), URLEncoder.encode(city, "UTF-8"), URLEncoder.encode(area, "UTF-8"));
                        ParamsVo paramsVo = new ParamsVo();
                        paramsVo.setTaskNum(taskNum);
                        paramsVo.setProvince(province);
                        paramsVo.setProvinceId(divisionIds.split("_")[0]);
                        paramsVo.setCity(city);
                        paramsVo.setCityId(divisionIds.split("_")[1]);
                        paramsVo.setArea(area);
                        paramsVo.setAreaId(divisionIds.split("_")[2]);
                        paramsVo.setFlag(flag);
                        list.add(paramsVo);
                    }
                } else {//除直辖市之外,其他省
                    if (n == 0) {
                        for (SysMenuVo sysMenuVo : sysMenuList) {
                            String name = sysMenuVo.getName();
                            if (district.equals(name)) {
                                List<SysMenuVo> citySysMenu = getSAreaTree(sysMenuVo.getValue());//获取该省下所有市
                                for (SysMenuVo citySysMenuVo : citySysMenu) {
                                    List<SysMenuVo> areaSysMenu = getSAreaTree(citySysMenuVo.getValue());//获取市下所有区县
                                    for (SysMenuVo areaSysMenuVo : areaSysMenu) {
                                        ParamsVo paramsVo = new ParamsVo();
                                        paramsVo.setTaskNum(taskNum);
                                        paramsVo.setProvince(district);
                                        paramsVo.setProvinceId(sysMenuVo.getValue());
                                        paramsVo.setCity(citySysMenuVo.getName());
                                        paramsVo.setCityId(citySysMenuVo.getValue());
                                        paramsVo.setArea(areaSysMenuVo.getName());
                                        paramsVo.setAreaId(areaSysMenuVo.getValue());
                                        paramsVo.setFlag(flag);
                                        list.add(paramsVo);
                                    }
                                }
                            }
                        }
                    } else if (n == 1) {
                        String province = district.split("-")[0];
                        String city = district.split("-")[1];
                        for (SysMenuVo sysMenuVo : sysMenuList) {
                            String name = sysMenuVo.getName();
                            if (province.equals(name)) {
                                List<SysMenuVo> citySysMenu = getSAreaTree(sysMenuVo.getValue());//获取该省下所有市
                                for (SysMenuVo citySysMenuVo : citySysMenu) {
                                    if (city.equals(citySysMenuVo.getName())) {
                                        List<SysMenuVo> areaSysMenu = getSAreaTree(citySysMenuVo.getValue());//获取市下所有区县
                                        for (SysMenuVo areaSysMenuVo : areaSysMenu) {
                                            ParamsVo paramsVo = new ParamsVo();
                                            paramsVo.setTaskNum(taskNum);
                                            paramsVo.setProvince(province);
                                            paramsVo.setProvinceId(sysMenuVo.getValue());
                                            paramsVo.setCity(citySysMenuVo.getName());
                                            paramsVo.setCityId(citySysMenuVo.getValue());
                                            paramsVo.setArea(areaSysMenuVo.getName());
                                            paramsVo.setAreaId(areaSysMenuVo.getValue());
                                            paramsVo.setFlag(flag);
                                            list.add(paramsVo);
                                        }
                                    }

                                }
                            }
                        }
                    } else if (n == 2) {
                        String province = district.split("-")[0];
                        String city = district.split("-")[1];
                        String area = district.split("-")[2];
                        String divisionIds = sysAreaService.getIdByCondition(URLEncoder.encode(province, "UTF-8"), URLEncoder.encode(city, "UTF-8"), URLEncoder.encode(area, "UTF-8"));
                        ParamsVo paramsVo = new ParamsVo();
                        paramsVo.setTaskNum(taskNum);
                        paramsVo.setProvince(province);
                        paramsVo.setProvinceId(divisionIds.split("_")[0]);
                        paramsVo.setCity(city);
                        paramsVo.setCityId(divisionIds.split("_")[1]);
                        paramsVo.setArea(area);
                        paramsVo.setAreaId(divisionIds.split("_")[2]);
                        paramsVo.setFlag(flag);
                        list.add(paramsVo);
                    }
                }
            }
        } else if (flag.equals("1")) {//按市
            for (String district : taskDistrict.split("、")) {
                int n = district.length() - district.replaceAll("-", "").length();
                if (district.contains("北京市") || district.contains("天津市") || district.contains("上海市") || district.contains("重庆市")) {
                    if (n == 0) {
                        for (SysMenuVo sysMenuVo : sysMenuList) {
                            String name = sysMenuVo.getName();
                            if (district.equals(name)) {
                                List<SysMenuVo> citySysMenu = getSAreaTree(sysMenuVo.getValue());//获取该省下所有市
                                for (SysMenuVo citySysMenuVo : citySysMenu) {
                                    List<SysMenuVo> areaSysMenu = getSAreaTree(citySysMenuVo.getValue());//获取市下所有区县
                                    for (SysMenuVo areaSysMenuVo : areaSysMenu) {
                                        ParamsVo paramsVo = new ParamsVo();
                                        paramsVo.setTaskNum(taskNum);
                                        paramsVo.setProvince(district);
                                        paramsVo.setProvinceId(sysMenuVo.getValue());
                                        paramsVo.setCity(citySysMenuVo.getName());
                                        paramsVo.setCityId(citySysMenuVo.getValue());
                                        paramsVo.setFlag(flag);
                                        list.add(paramsVo);
                                        areaIdList.add(areaSysMenuVo.getValue());
                                    }
                                }
                            }
                        }
                    } else if (n == 1) {
                        String province = district.split("-")[0];
                        String city = district.split("-")[0];
                        String area = district.split("-")[1];
                        String divisionIds = sysAreaService.getIdByCondition(URLEncoder.encode(province, "UTF-8"), URLEncoder.encode(city, "UTF-8"), URLEncoder.encode(area, "UTF-8"));
                        ParamsVo paramsVo = new ParamsVo();
                        paramsVo.setTaskNum(taskNum);
                        paramsVo.setProvince(province);
                        paramsVo.setProvinceId(divisionIds.split("_")[0]);
                        paramsVo.setCity(city);
                        paramsVo.setCityId(divisionIds.split("_")[1]);
                        paramsVo.setFlag(flag);
                        list.add(paramsVo);
                        areaIdList.add(divisionIds.split("_")[2]);
                    }
                } else {//除直辖市外,所有省市
                    if (n == 0) {
                        for (SysMenuVo sysMenuVo : sysMenuList) {
                            String name = sysMenuVo.getName();
                            if (district.equals(name)) {
                                List<SysMenuVo> citySysMenu = getSAreaTree(sysMenuVo.getValue());//获取该省下所有市
                                for (SysMenuVo citySysMenuVo : citySysMenu) {
                                    ParamsVo paramsVo = new ParamsVo();
                                    paramsVo.setTaskNum(taskNum);
                                    paramsVo.setProvince(district);
                                    paramsVo.setProvinceId(sysMenuVo.getValue());
                                    paramsVo.setCity(citySysMenuVo.getName());
                                    paramsVo.setCityId(citySysMenuVo.getValue());
                                    paramsVo.setFlag(flag);
                                    list.add(paramsVo);
                                }
                            }
                        }
                    } else if (n == 1) {
                        String province = district.split("-")[0];
                        String city = district.split("-")[1];
                        for (SysMenuVo sysMenuVo : sysMenuList) {
                            String name = sysMenuVo.getName();
                            if (province.equals(name)) {
                                List<SysMenuVo> citySysMenu = getSAreaTree(sysMenuVo.getValue());//获取该省下所有市
                                for (SysMenuVo citySysMenuVo : citySysMenu) {
                                    if (city.equals(citySysMenuVo.getName())) {
                                        ParamsVo paramsVo = new ParamsVo();
                                        paramsVo.setTaskNum(taskNum);
                                        paramsVo.setProvince(province);
                                        paramsVo.setProvinceId(sysMenuVo.getValue());
                                        paramsVo.setCity(citySysMenuVo.getName());
                                        paramsVo.setCityId(citySysMenuVo.getValue());
                                        paramsVo.setFlag(flag);
                                        list.add(paramsVo);
                                    }
                                }
                            }
                        }
                    } else if (n == 2) {
                        String province = district.split("-")[0];
                        String city = district.split("-")[1];
                        String area = district.split("-")[2];
                        String divisionIds = sysAreaService.getIdByCondition(URLEncoder.encode(province, "UTF-8"), URLEncoder.encode(city, "UTF-8"), URLEncoder.encode(area, "UTF-8"));
                        ParamsVo paramsVo = new ParamsVo();
                        paramsVo.setTaskNum(taskNum);
                        paramsVo.setProvince(province);
                        paramsVo.setProvinceId(divisionIds.split("_")[0]);
                        paramsVo.setCity(city);
                        paramsVo.setCityId(divisionIds.split("_")[1]);
                        //paramsVo.setArea(area);
                        //paramsVo.setAreaId(divisionIds.split("_")[2]);
                        paramsVo.setFlag(flag);
                        list.add(paramsVo);
                        areaIdList.add(divisionIds.split("_")[2]);

                    }
                }
            }
        }
        list = duplicateRemoval(list);//去重
        Map<String, Object> map = new HashMap<>();
        List<DisasterScenarioEntity> list1 = new ArrayList<>();
        List<AnnualRiskEntity> list2 = new ArrayList<>();
        List<EmergencyDisasterEntity> list3 = new ArrayList<>();
        List<EmergencyDisposalEntity> list4 = new ArrayList<>();
        String a = "", b = "";
        //根据获取的省市县,查询数据
        for (ParamsVo paramsVo : list) {
            if (suggestionName.equals("灾害情景分析")) {
                String buildingDamage = "";
                String casualties = "";
                String geologicHazard = "";
                String secondaryDisaster = "";
                String earthquakeTraffic = "";
                String otherDisaster = "";
                DisasterScenarioEntity disasterScenarioData = disasterScenarioService.getDisasterScenarioData(paramsVo);
                if (PlatformObjectUtils.isEmpty(disasterScenarioData)) {
                    if (paramsVo.getFlag().equals("0")) {//按区县
                        //和建议管理相关联(仅关联区县级别数据)
                        DisasterScenarioManageEntity disasterScenarioManageEntity = disasterScenarioManageService.getDisasterScenarioManageData(paramsVo);
                        if (!PlatformObjectUtils.isEmpty(disasterScenarioManageEntity)) {
                            DisasterScenarioEntity disasterScenarioEntity = new DisasterScenarioEntity();
                            SpringUtil.copyPropertiesIgnoreNull(disasterScenarioManageEntity, disasterScenarioEntity);
                            list1.add(disasterScenarioEntity);
                        } else {
                            DisasterScenarioEntity disasterScenarioEntity = new DisasterScenarioEntity();
                            disasterScenarioEntity.setProvince(paramsVo.getProvince());
                            disasterScenarioEntity.setProvinceId(paramsVo.getProvinceId());
                            disasterScenarioEntity.setCity(paramsVo.getCity());
                            disasterScenarioEntity.setCityId(paramsVo.getCityId());
                            disasterScenarioEntity.setArea(paramsVo.getArea());
                            disasterScenarioEntity.setAreaId(paramsVo.getAreaId());
                            list1.add(disasterScenarioEntity);
                        }
                    } else if (paramsVo.getFlag().equals("1")) {//按地市
                        List<DisasterScenarioEntity> disasterScenarioAreaData = disasterScenarioService.getDisasterScenarioAreaData(paramsVo);//获取建议分析所有区县数据
                        if (!PlatformObjectUtils.isEmpty(disasterScenarioAreaData)) {
                            for (DisasterScenarioEntity entity : disasterScenarioAreaData) {
                                if (!PlatformObjectUtils.isEmpty(entity.getBuildingDamage())) {
                                    buildingDamage += entity.getArea() + "：" + entity.getBuildingDamage() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getCasualties())) {
                                    casualties += entity.getArea() + "：" + entity.getCasualties() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getGeologicHazard())) {
                                    geologicHazard += entity.getArea() + "：" + entity.getGeologicHazard() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getSecondaryDisaster())) {
                                    secondaryDisaster += entity.getArea() + "：" + entity.getSecondaryDisaster() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getEarthquakeTraffic())) {
                                    earthquakeTraffic += entity.getArea() + "：" + entity.getEarthquakeTraffic() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getOtherDisaster())) {
                                    otherDisaster += entity.getArea() + "：" + entity.getOtherDisaster() + "；\n";
                                }
                            }
                            DisasterScenarioEntity entity = new DisasterScenarioEntity();
                            entity.setProvince(paramsVo.getProvince());
                            entity.setProvinceId(paramsVo.getProvinceId());
                            entity.setCity(paramsVo.getCity());
                            entity.setCityId(paramsVo.getCityId());
                            entity.setBuildingDamage(buildingDamage);
                            entity.setCasualties(casualties);
                            entity.setGeologicHazard(geologicHazard);
                            entity.setSecondaryDisaster(secondaryDisaster);
                            entity.setEarthquakeTraffic(earthquakeTraffic);
                            entity.setOtherDisaster(otherDisaster);
                            list1.add(entity);
                        } else {
                            List<DisasterScenarioManageEntity> manageAreaList = disasterScenarioManageService.getDisasterScenarioManageAreaData(paramsVo);//获取建议管理所有区县级数据
                            if (!PlatformObjectUtils.isEmpty(manageAreaList)) {
                                String areaId = "";
                                for (DisasterScenarioManageEntity entity : manageAreaList) {
                                    areaId = entity.getAreaId();
                                    if (!PlatformObjectUtils.isEmpty(entity.getBuildingDamage())) {
                                        buildingDamage += entity.getArea() + "：" + entity.getBuildingDamage() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getCasualties())) {
                                        casualties += entity.getArea() + "：" + entity.getCasualties() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getGeologicHazard())) {
                                        geologicHazard += entity.getArea() + "：" + entity.getGeologicHazard() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getSecondaryDisaster())) {
                                        secondaryDisaster += entity.getArea() + "：" + entity.getSecondaryDisaster() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getEarthquakeTraffic())) {
                                        earthquakeTraffic += entity.getArea() + "：" + entity.getEarthquakeTraffic() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getOtherDisaster())) {
                                        otherDisaster += entity.getArea() + "：" + entity.getOtherDisaster() + "；\n";
                                    }
                                }
                                if (areaIdList.contains(areaId)) {
                                    DisasterScenarioEntity entity = new DisasterScenarioEntity();
                                    entity.setProvince(paramsVo.getProvince());
                                    entity.setProvinceId(paramsVo.getProvinceId());
                                    entity.setCity(paramsVo.getCity());
                                    entity.setCityId(paramsVo.getCityId());
                                    entity.setBuildingDamage(buildingDamage);
                                    entity.setCasualties(casualties);
                                    entity.setGeologicHazard(geologicHazard);
                                    entity.setSecondaryDisaster(secondaryDisaster);
                                    entity.setEarthquakeTraffic(earthquakeTraffic);
                                    entity.setOtherDisaster(otherDisaster);
                                    list1.add(entity);
                                }
                            } else {
                                DisasterScenarioEntity disasterScenarioEntity = new DisasterScenarioEntity();
                                disasterScenarioEntity.setProvince(paramsVo.getProvince());
                                disasterScenarioEntity.setProvinceId(paramsVo.getProvinceId());
                                disasterScenarioEntity.setCity(paramsVo.getCity());
                                disasterScenarioEntity.setCityId(paramsVo.getCityId());
                                list1.add(disasterScenarioEntity);
                            }
                        }
                    }
                } else {
                    list1.add(disasterScenarioData);
                }
            } else if (suggestionName.equals("年度风险应对策略建议")) {
                String building = "";
                String disasterHiddenDanger = "";
                String lifelineSystem = "";
                String majorInfrastructure = "";
                String otherAnnualDisaster = "";
                AnnualRiskEntity annualRiskData = annualRiskService.getAnnualRiskData(paramsVo);//获取建议分析数据
                if (PlatformObjectUtils.isEmpty(annualRiskData)) {
                    if (paramsVo.getFlag().equals("0")) {//按区县
                        AnnualRiskManageEntity annualRiskManageEntity = annualRiskManageService.getAnnualRiskManageData(paramsVo);//根据省市区id获取建议管理数据
                        if (!PlatformObjectUtils.isEmpty(annualRiskManageEntity)) {
                            AnnualRiskEntity annualRiskEntity = new AnnualRiskEntity();
                            SpringUtil.copyPropertiesIgnoreNull(annualRiskManageEntity, annualRiskEntity);
                            list2.add(annualRiskEntity);
                        } else {
                            AnnualRiskEntity annualRiskEntity = new AnnualRiskEntity();
                            annualRiskEntity.setProvince(paramsVo.getProvince());
                            annualRiskEntity.setProvinceId(paramsVo.getProvinceId());
                            annualRiskEntity.setCity(paramsVo.getCity());
                            annualRiskEntity.setCityId(paramsVo.getCityId());
                            annualRiskEntity.setArea(paramsVo.getArea());
                            annualRiskEntity.setAreaId(paramsVo.getAreaId());
                            list2.add(annualRiskEntity);
                        }
                    } else if (paramsVo.getFlag().equals("1")) {//地市
                        List<AnnualRiskEntity> annualRiskAreaData = annualRiskService.getAnnualRiskAreaData(paramsVo);//获取建议分析所有区县数据
                        if (!PlatformObjectUtils.isEmpty(annualRiskAreaData)) {
                            for (AnnualRiskEntity entity : annualRiskAreaData) {
                                if (!PlatformObjectUtils.isEmpty(entity.getBuilding())) {
                                    building += entity.getArea() + "：" + entity.getBuilding() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getDisasterHiddenDanger())) {
                                    disasterHiddenDanger += entity.getArea() + "：" + entity.getDisasterHiddenDanger() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getLifelineSystem())) {
                                    lifelineSystem += entity.getArea() + "：" + entity.getLifelineSystem() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getMajorInfrastructure())) {
                                    majorInfrastructure += entity.getArea() + "：" + entity.getMajorInfrastructure() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getOtherAnnualDisaster())) {
                                    otherAnnualDisaster += entity.getArea() + "：" + entity.getOtherAnnualDisaster() + "；\n";
                                }
                            }
                            AnnualRiskEntity annualRiskEntity = new AnnualRiskEntity();
                            annualRiskEntity.setProvince(paramsVo.getProvince());
                            annualRiskEntity.setProvinceId(paramsVo.getProvinceId());
                            annualRiskEntity.setCity(paramsVo.getCity());
                            annualRiskEntity.setCityId(paramsVo.getCityId());
                            annualRiskEntity.setBuilding(building);
                            annualRiskEntity.setDisasterHiddenDanger(disasterHiddenDanger);
                            annualRiskEntity.setLifelineSystem(lifelineSystem);
                            annualRiskEntity.setMajorInfrastructure(majorInfrastructure);
                            annualRiskEntity.setOtherAnnualDisaster(otherAnnualDisaster);
                            list2.add(annualRiskEntity);
                        } else {
                            List<AnnualRiskManageEntity> manageAreaList = annualRiskManageService.getAnnualRiskManageAreaData(paramsVo);//获取建议管理所有区县级数据
                            if (!PlatformObjectUtils.isEmpty(manageAreaList)) {
                                String areaId = "";
                                for (AnnualRiskManageEntity entity : manageAreaList) {
                                    areaId = entity.getAreaId();
                                    if (!PlatformObjectUtils.isEmpty(entity.getBuilding())) {
                                        building += entity.getArea() + "：" + entity.getBuilding() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getDisasterHiddenDanger())) {
                                        disasterHiddenDanger += entity.getArea() + "：" + entity.getDisasterHiddenDanger() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getLifelineSystem())) {
                                        lifelineSystem += entity.getArea() + "：" + entity.getLifelineSystem() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getMajorInfrastructure())) {
                                        majorInfrastructure += entity.getArea() + "：" + entity.getMajorInfrastructure() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getOtherAnnualDisaster())) {
                                        otherAnnualDisaster += entity.getArea() + "：" + entity.getOtherAnnualDisaster() + "；\n";
                                    }
                                }
                                if (areaIdList.contains(areaId)) {
                                    AnnualRiskEntity entity = new AnnualRiskEntity();
                                    entity.setProvince(paramsVo.getProvince());
                                    entity.setProvinceId(paramsVo.getProvinceId());
                                    entity.setCity(paramsVo.getCity());
                                    entity.setCityId(paramsVo.getCityId());
                                    entity.setBuilding(building);
                                    entity.setDisasterHiddenDanger(disasterHiddenDanger);
                                    entity.setLifelineSystem(lifelineSystem);
                                    entity.setMajorInfrastructure(majorInfrastructure);
                                    entity.setOtherAnnualDisaster(otherAnnualDisaster);
                                    list2.add(entity);
                                }
                            } else {
                                AnnualRiskEntity entity = new AnnualRiskEntity();
                                entity.setProvince(paramsVo.getProvince());
                                entity.setProvinceId(paramsVo.getProvinceId());
                                entity.setCity(paramsVo.getCity());
                                entity.setCityId(paramsVo.getCityId());
                                list2.add(entity);
                            }
                        }
                    }
                } else {
                    list2.add(annualRiskData);
                }

            } else if (suggestionName.equals("应急备灾对策")) {
                String emergencySystem = "";
                String emergencyWorkingMechanism = "";
                String emergencySuppliesReserve = "";
                String emergencyRescueForce = "";
                String emergencyShelter = "";
                String supportability = "";
                String rumorEmergencyCapacity = "";
                String popularization = "";
                String otherMeasures = "";
                EmergencyDisasterEntity emergencyDisasterData = emergencyDisasterService.getEmergencyDisasterData(paramsVo);
                if (PlatformObjectUtils.isEmpty(emergencyDisasterData)) {
                    if (paramsVo.getFlag().equals("0")) {//按区县
                        EmergencyDisasterManageEntity emergencyDisasterManageEntity = emergencyDisasterManageService.getEmergencyDisasterManageData(paramsVo);
                        if (!PlatformObjectUtils.isEmpty(emergencyDisasterManageEntity)) {
                            EmergencyDisasterEntity emergencyDisasterEntity = new EmergencyDisasterEntity();
                            SpringUtil.copyPropertiesIgnoreNull(emergencyDisasterManageEntity, emergencyDisasterEntity);
                            list3.add(emergencyDisasterEntity);
                        } else {
                            EmergencyDisasterEntity emergencyDisasterEntity = new EmergencyDisasterEntity();
                            emergencyDisasterEntity.setProvince(paramsVo.getProvince());
                            emergencyDisasterEntity.setProvinceId(paramsVo.getProvinceId());
                            emergencyDisasterEntity.setCity(paramsVo.getCity());
                            emergencyDisasterEntity.setCityId(paramsVo.getCityId());
                            emergencyDisasterEntity.setArea(paramsVo.getArea());
                            emergencyDisasterEntity.setAreaId(paramsVo.getAreaId());
                            list3.add(emergencyDisasterEntity);
                        }
                    } else if (paramsVo.getFlag().equals("1")) {//按地市
                        List<EmergencyDisasterEntity> emergencyDisasterAreaData = emergencyDisasterService.getEmergencyDisasterAreaData(paramsVo);//获取所有区县数据
                        if (!PlatformObjectUtils.isEmpty(emergencyDisasterAreaData)) {
                            for (EmergencyDisasterEntity entity : emergencyDisasterAreaData) {
                                if (!PlatformObjectUtils.isEmpty(entity.getEmergencySystem())) {
                                    emergencySystem += entity.getArea() + "：" + entity.getEmergencySystem() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getEmergencyWorkingMechanism())) {
                                    emergencyWorkingMechanism += entity.getArea() + "：" + entity.getEmergencyWorkingMechanism() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getEmergencySuppliesReserve())) {
                                    emergencySuppliesReserve += entity.getArea() + "：" + entity.getEmergencySuppliesReserve() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getEmergencyRescueForce())) {
                                    emergencyRescueForce += entity.getArea() + "：" + entity.getEmergencyRescueForce() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getEmergencyShelter())) {
                                    emergencyShelter += entity.getArea() + "：" + entity.getEmergencyShelter() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getSupportability())) {
                                    supportability += entity.getArea() + "：" + entity.getSupportability() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getRumorEmergencyCapacity())) {
                                    rumorEmergencyCapacity += entity.getArea() + "：" + entity.getRumorEmergencyCapacity() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getPopularization())) {
                                    popularization += entity.getArea() + "：" + entity.getPopularization() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getOtherMeasures())) {
                                    otherMeasures += entity.getArea() + "：" + entity.getOtherMeasures() + "；\n";
                                }
                            }
                            EmergencyDisasterEntity emergencyDisasterEntity = new EmergencyDisasterEntity();
                            emergencyDisasterEntity.setProvince(paramsVo.getProvince());
                            emergencyDisasterEntity.setProvinceId(paramsVo.getProvinceId());
                            emergencyDisasterEntity.setCity(paramsVo.getCity());
                            emergencyDisasterEntity.setCityId(paramsVo.getCityId());
                            emergencyDisasterEntity.setEmergencySystem(emergencySystem);
                            emergencyDisasterEntity.setEmergencyWorkingMechanism(emergencyWorkingMechanism);
                            emergencyDisasterEntity.setEmergencySuppliesReserve(emergencySuppliesReserve);
                            emergencyDisasterEntity.setEmergencyRescueForce(emergencyRescueForce);
                            emergencyDisasterEntity.setEmergencyShelter(emergencyShelter);
                            emergencyDisasterEntity.setSupportability(supportability);
                            emergencyDisasterEntity.setRumorEmergencyCapacity(rumorEmergencyCapacity);
                            emergencyDisasterEntity.setPopularization(popularization);
                            emergencyDisasterEntity.setOtherMeasures(otherMeasures);
                            list3.add(emergencyDisasterEntity);
                        } else {
                            List<EmergencyDisasterManageEntity> manageAreaList = emergencyDisasterManageService.getEmergencyDisasterManageAreaData(paramsVo);//获取建议管理所有区县级数据
                            if (!PlatformObjectUtils.isEmpty(manageAreaList)) {
                                String areaId = "";
                                for (EmergencyDisasterManageEntity entity : manageAreaList) {
                                    areaId = entity.getAreaId();
                                    if (!PlatformObjectUtils.isEmpty(entity.getEmergencySystem())) {
                                        emergencySystem += entity.getArea() + "：" + entity.getEmergencySystem() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getEmergencyWorkingMechanism())) {
                                        emergencyWorkingMechanism += entity.getArea() + "：" + entity.getEmergencyWorkingMechanism() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getEmergencySuppliesReserve())) {
                                        emergencySuppliesReserve += entity.getArea() + "：" + entity.getEmergencySuppliesReserve() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getEmergencyRescueForce())) {
                                        emergencyRescueForce += entity.getArea() + "：" + entity.getEmergencyRescueForce() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getEmergencyShelter())) {
                                        emergencyShelter += entity.getArea() + "：" + entity.getEmergencyShelter() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getSupportability())) {
                                        supportability += entity.getArea() + "：" + entity.getSupportability() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getRumorEmergencyCapacity())) {
                                        rumorEmergencyCapacity += entity.getArea() + "：" + entity.getRumorEmergencyCapacity() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getPopularization())) {
                                        popularization += entity.getArea() + "：" + entity.getPopularization() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getOtherMeasures())) {
                                        otherMeasures += entity.getArea() + "：" + entity.getOtherMeasures() + "；\n";
                                    }
                                }
                                if (areaIdList.contains(areaId)) {
                                    EmergencyDisasterEntity emergencyDisasterEntity = new EmergencyDisasterEntity();
                                    emergencyDisasterEntity.setProvince(paramsVo.getProvince());
                                    emergencyDisasterEntity.setProvinceId(paramsVo.getProvinceId());
                                    emergencyDisasterEntity.setCity(paramsVo.getCity());
                                    emergencyDisasterEntity.setCityId(paramsVo.getCityId());
                                    emergencyDisasterEntity.setEmergencySystem(emergencySystem);
                                    emergencyDisasterEntity.setEmergencyWorkingMechanism(emergencyWorkingMechanism);
                                    emergencyDisasterEntity.setEmergencySuppliesReserve(emergencySuppliesReserve);
                                    emergencyDisasterEntity.setEmergencyRescueForce(emergencyRescueForce);
                                    emergencyDisasterEntity.setEmergencyShelter(emergencyShelter);
                                    emergencyDisasterEntity.setSupportability(supportability);
                                    emergencyDisasterEntity.setRumorEmergencyCapacity(rumorEmergencyCapacity);
                                    emergencyDisasterEntity.setPopularization(popularization);
                                    emergencyDisasterEntity.setOtherMeasures(otherMeasures);
                                    list3.add(emergencyDisasterEntity);
                                }
                            } else {
                                EmergencyDisasterEntity emergencyDisasterEntity = new EmergencyDisasterEntity();
                                emergencyDisasterEntity.setProvince(paramsVo.getProvince());
                                emergencyDisasterEntity.setProvinceId(paramsVo.getProvinceId());
                                emergencyDisasterEntity.setCity(paramsVo.getCity());
                                emergencyDisasterEntity.setCityId(paramsVo.getCityId());
                                list3.add(emergencyDisasterEntity);
                            }
                        }
                    }
                } else {
                    list3.add(emergencyDisasterData);
                }
            } else if (suggestionName.equals("应急处置对策")) {
                String rescueForceMaterialInput = "";
                String earthquakeDisasterCriticalArea = "";
                String trafficSystemSupportRepair = "";
                String communicationsSystemSupportRepair = "";
                String powerSystemSupportRepair = "";
                String importantFacilitiesCheck = "";
                String climateFeatureReply = "";
                String nationFeatureReply = "";
                String rumorReply = "";
                String otherFeatureReply = "";
                EmergencyDisposalEntity emergencyDisposalData = emergencyDisposalService.getEmergencyDisposalData(paramsVo);
                if (PlatformObjectUtils.isEmpty(emergencyDisposalData)) {
                    if (paramsVo.getFlag().equals("0")) {//按区县
                        EmergencyDisposalManageEntity emergencyDisposalManageEntity = emergencyDisposalManageService.getEmergencyDisposalManageData(paramsVo);
                        if (!PlatformObjectUtils.isEmpty(emergencyDisposalManageEntity)) {
                            EmergencyDisposalEntity emergencyDisposalEntity = new EmergencyDisposalEntity();
                            SpringUtil.copyPropertiesIgnoreNull(emergencyDisposalManageEntity, emergencyDisposalEntity);
                            list4.add(emergencyDisposalEntity);
                        } else {
                            EmergencyDisposalEntity emergencyDisposalEntity = new EmergencyDisposalEntity();
                            emergencyDisposalEntity.setProvince(paramsVo.getProvince());
                            emergencyDisposalEntity.setProvinceId(paramsVo.getProvinceId());
                            emergencyDisposalEntity.setCity(paramsVo.getCity());
                            emergencyDisposalEntity.setCityId(paramsVo.getCityId());
                            emergencyDisposalEntity.setArea(paramsVo.getArea());
                            emergencyDisposalEntity.setAreaId(paramsVo.getAreaId());
                            list4.add(emergencyDisposalEntity);
                        }
                    } else if (paramsVo.getFlag().equals("1")) {
                        List<EmergencyDisposalEntity> emergencyDisposalAreaData = emergencyDisposalService.getEmergencyDisposalAreaData(paramsVo);//获取所有区县数据
                        if (!PlatformObjectUtils.isEmpty(emergencyDisposalAreaData)) {
                            for (EmergencyDisposalEntity entity : emergencyDisposalAreaData) {
                                if (!PlatformObjectUtils.isEmpty(entity.getRescueForceMaterialInput())) {
                                    rescueForceMaterialInput += entity.getArea() + "：" + entity.getRescueForceMaterialInput() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getEarthquakeDisasterCriticalArea())) {
                                    earthquakeDisasterCriticalArea += entity.getArea() + "：" + entity.getEarthquakeDisasterCriticalArea() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getTrafficSystemSupportRepair())) {
                                    trafficSystemSupportRepair += entity.getArea() + "：" + entity.getTrafficSystemSupportRepair() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getCommunicationsSystemSupportRepair())) {
                                    communicationsSystemSupportRepair += entity.getArea() + "：" + entity.getCommunicationsSystemSupportRepair() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getPowerSystemSupportRepair())) {
                                    powerSystemSupportRepair += entity.getArea() + "：" + entity.getPowerSystemSupportRepair() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getImportantFacilitiesCheck())) {
                                    importantFacilitiesCheck += entity.getArea() + "：" + entity.getImportantFacilitiesCheck() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getClimateFeatureReply())) {
                                    climateFeatureReply += entity.getArea() + "：" + entity.getClimateFeatureReply() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getNationFeatureReply())) {
                                    nationFeatureReply += entity.getArea() + "：" + entity.getNationFeatureReply() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getRumorReply())) {
                                    rumorReply += entity.getArea() + "：" + entity.getRumorReply() + "；\n";
                                }
                                if (!PlatformObjectUtils.isEmpty(entity.getOtherFeatureReply())) {
                                    otherFeatureReply += entity.getArea() + "：" + entity.getOtherFeatureReply() + "；\n";
                                }
                            }
                            EmergencyDisposalEntity emergencyDisposalEntity = new EmergencyDisposalEntity();
                            emergencyDisposalEntity.setProvince(paramsVo.getProvince());
                            emergencyDisposalEntity.setProvinceId(paramsVo.getProvinceId());
                            emergencyDisposalEntity.setCity(paramsVo.getCity());
                            emergencyDisposalEntity.setCityId(paramsVo.getCityId());
                            emergencyDisposalEntity.setRescueForceMaterialInput(rescueForceMaterialInput);
                            emergencyDisposalEntity.setEarthquakeDisasterCriticalArea(earthquakeDisasterCriticalArea);
                            emergencyDisposalEntity.setTrafficSystemSupportRepair(trafficSystemSupportRepair);
                            emergencyDisposalEntity.setCommunicationsSystemSupportRepair(communicationsSystemSupportRepair);
                            emergencyDisposalEntity.setPowerSystemSupportRepair(powerSystemSupportRepair);
                            emergencyDisposalEntity.setImportantFacilitiesCheck(importantFacilitiesCheck);
                            emergencyDisposalEntity.setClimateFeatureReply(climateFeatureReply);
                            emergencyDisposalEntity.setNationFeatureReply(nationFeatureReply);
                            emergencyDisposalEntity.setRumorReply(rumorReply);
                            emergencyDisposalEntity.setOtherFeatureReply(otherFeatureReply);
                            list4.add(emergencyDisposalEntity);
                        } else {
                            List<EmergencyDisposalManageEntity> manageAreaList = emergencyDisposalManageService.getEmergencyDisposalManageAreaData(paramsVo);//获取建议管理所有区县级数据
                            if (!PlatformObjectUtils.isEmpty(manageAreaList)) {
                                String areaId = "";
                                for (EmergencyDisposalManageEntity entity : manageAreaList) {
                                    areaId = entity.getAreaId();
                                    if (!PlatformObjectUtils.isEmpty(entity.getRescueForceMaterialInput())) {
                                        rescueForceMaterialInput += entity.getArea() + "：" + entity.getRescueForceMaterialInput() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getEarthquakeDisasterCriticalArea())) {
                                        earthquakeDisasterCriticalArea += entity.getArea() + "：" + entity.getEarthquakeDisasterCriticalArea() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getTrafficSystemSupportRepair())) {
                                        trafficSystemSupportRepair += entity.getArea() + "：" + entity.getTrafficSystemSupportRepair() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getCommunicationsSystemSupportRepair())) {
                                        communicationsSystemSupportRepair += entity.getArea() + "：" + entity.getCommunicationsSystemSupportRepair() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getPowerSystemSupportRepair())) {
                                        powerSystemSupportRepair += entity.getArea() + "：" + entity.getPowerSystemSupportRepair() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getImportantFacilitiesCheck())) {
                                        importantFacilitiesCheck += entity.getArea() + "：" + entity.getImportantFacilitiesCheck() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getClimateFeatureReply())) {
                                        climateFeatureReply += entity.getArea() + "：" + entity.getClimateFeatureReply() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getNationFeatureReply())) {
                                        nationFeatureReply += entity.getArea() + "：" + entity.getNationFeatureReply() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getRumorReply())) {
                                        rumorReply += entity.getArea() + "：" + entity.getRumorReply() + "；\n";
                                    }
                                    if (!PlatformObjectUtils.isEmpty(entity.getOtherFeatureReply())) {
                                        otherFeatureReply += entity.getArea() + "：" + entity.getOtherFeatureReply() + "；\n";
                                    }
                                }
                                if (areaIdList.contains(areaId)) {
                                    EmergencyDisposalEntity emergencyDisposalEntity = new EmergencyDisposalEntity();
                                    emergencyDisposalEntity.setProvince(paramsVo.getProvince());
                                    emergencyDisposalEntity.setProvinceId(paramsVo.getProvinceId());
                                    emergencyDisposalEntity.setCity(paramsVo.getCity());
                                    emergencyDisposalEntity.setCityId(paramsVo.getCityId());
                                    emergencyDisposalEntity.setRescueForceMaterialInput(rescueForceMaterialInput);
                                    emergencyDisposalEntity.setEarthquakeDisasterCriticalArea(earthquakeDisasterCriticalArea);
                                    emergencyDisposalEntity.setTrafficSystemSupportRepair(trafficSystemSupportRepair);
                                    emergencyDisposalEntity.setCommunicationsSystemSupportRepair(communicationsSystemSupportRepair);
                                    emergencyDisposalEntity.setPowerSystemSupportRepair(powerSystemSupportRepair);
                                    emergencyDisposalEntity.setImportantFacilitiesCheck(importantFacilitiesCheck);
                                    emergencyDisposalEntity.setClimateFeatureReply(climateFeatureReply);
                                    emergencyDisposalEntity.setNationFeatureReply(nationFeatureReply);
                                    emergencyDisposalEntity.setRumorReply(rumorReply);
                                    emergencyDisposalEntity.setOtherFeatureReply(otherFeatureReply);
                                    list4.add(emergencyDisposalEntity);
                                }
                            } else {
                                EmergencyDisposalEntity emergencyDisposalEntity = new EmergencyDisposalEntity();
                                emergencyDisposalEntity.setProvince(paramsVo.getProvince());
                                emergencyDisposalEntity.setProvinceId(paramsVo.getProvinceId());
                                emergencyDisposalEntity.setCity(paramsVo.getCity());
                                emergencyDisposalEntity.setCityId(paramsVo.getCityId());
                                list4.add(emergencyDisposalEntity);
                            }
                        }
                    }
                } else {
                    list4.add(emergencyDisposalData);
                }
            }
            a = paramsVo.getProvince();
            b = paramsVo.getCity();
        }
        map.put("灾害情景分析", list1);
        map.put("年度风险应对策略建议", list2);
        map.put("应急备灾对策", list3);
        map.put("应急处置对策", list4);
        return map;
    }

    private List<SysMenuVo> getSAreaTree(String divisionId) throws UnsupportedEncodingException {
        String jsonStr = sysAreaService.jsonSAreaTree(URLEncoder.encode(divisionId, "UTF-8"));
        Gson gson = CreateGson.createGson();
        Type srItemsStandardType = new TypeToken<List<SysMenuVo>>() {
        }.getType();
        List<SysMenuVo> sysMenuList = gson.fromJson(jsonStr, srItemsStandardType);
        return sysMenuList;
    }

    private List<ParamsVo> duplicateRemoval(List<ParamsVo> list) {
        Set set = new HashSet();
        List<ParamsVo> newList = new ArrayList<>();
        for (Iterator iter = list.iterator(); iter.hasNext(); ) {
            Object next = iter.next();
            if (set.add(next)) {
                newList.add((ParamsVo) next);
            }
        }
        list.clear();
        list.addAll(newList);
        return list;
    }

    @Transactional
    @Override
    public Boolean saveDisasterScenario(List<DisasterScenarioEntity> list) throws UnsupportedEncodingException {
        List<DisasterScenarioEntity> updateList = new ArrayList<>();
        List<DisasterScenarioEntity> saveList = new ArrayList<>();
        Boolean res = false;
        if (!PlatformObjectUtils.isEmpty(list)) {
            for (int i = 0; i < list.size(); i++) {
                DisasterScenarioEntity disasterScenarioEntity = list.get(i);
                //判断有没有id,没有id则保存,有id则更新
                if (PlatformObjectUtils.isEmpty(disasterScenarioEntity.getId())) {
                    saveList.add(disasterScenarioEntity);
                } else {
                    //判断id是否是分析表中.是则更新,不是则保存,有id可能是建议管理表中的数据
                    int count = disasterScenarioService.getCountById(disasterScenarioEntity.getId());
                    if (count == 0) {//不在分析表中
                        saveList.add(disasterScenarioEntity);
                    } else {
                        updateList.add(disasterScenarioEntity);
                    }
                }
            }
            for (DisasterScenarioEntity disasterScenarioEntity : saveList) {
                res = disasterScenarioService.save(disasterScenarioEntity);
            }
            for (DisasterScenarioEntity disasterScenarioEntity : updateList) {
                res = disasterScenarioService.update(disasterScenarioEntity);
            }
            // 灾害情景分析同步到灾害情景管理
            for (DisasterScenarioEntity disasterScenarioEntity : list) {
                DisasterScenarioManageEntity disasterScenarioManageEntity = disasterScenarioManageService.getByProvinceCityCounty(disasterScenarioEntity.getProvinceId(), disasterScenarioEntity.getCityId(), disasterScenarioEntity.getAreaId());
                if (disasterScenarioManageEntity != null) {
                    disasterScenarioManageEntity.setBuildingDamage(disasterScenarioEntity.getBuildingDamage());
                    disasterScenarioManageEntity.setCasualties(disasterScenarioEntity.getCasualties());
                    disasterScenarioManageEntity.setGeologicHazard(disasterScenarioEntity.getGeologicHazard());
                    disasterScenarioManageEntity.setSecondaryDisaster(disasterScenarioEntity.getSecondaryDisaster());
                    disasterScenarioManageEntity.setEarthquakeTraffic(disasterScenarioEntity.getEarthquakeTraffic());
                    disasterScenarioManageEntity.setOtherDisaster(disasterScenarioEntity.getOtherDisaster());
                    if (PlatformObjectUtils.isNotEmpty(disasterScenarioEntity.getArea())){
                        disasterScenarioManageService.update(disasterScenarioManageEntity);
                    }
                } else {
                    disasterScenarioManageEntity = new DisasterScenarioManageEntity();
                    disasterScenarioManageEntity.setId(IdUtil.simpleUUID());
                    disasterScenarioManageEntity.setBuildingDamage(disasterScenarioEntity.getBuildingDamage());
                    disasterScenarioManageEntity.setCasualties(disasterScenarioEntity.getCasualties());
                    disasterScenarioManageEntity.setGeologicHazard(disasterScenarioEntity.getGeologicHazard());
                    disasterScenarioManageEntity.setSecondaryDisaster(disasterScenarioEntity.getSecondaryDisaster());
                    disasterScenarioManageEntity.setEarthquakeTraffic(disasterScenarioEntity.getEarthquakeTraffic());
                    disasterScenarioManageEntity.setOtherDisaster(disasterScenarioEntity.getOtherDisaster());
                    disasterScenarioManageEntity.setDelFlag(YNEnum.N.toString());
                    disasterScenarioManageEntity.setCreateTime(new Date());
                    disasterScenarioManageEntity.setCreateId(PlatformSessionContext.getUserID());
                    disasterScenarioManageEntity.setUpdateId(PlatformSessionContext.getUserID());
                    disasterScenarioManageEntity.setUpdateTime(new Date());
                    disasterScenarioManageEntity.setProvince(disasterScenarioEntity.getProvince());
                    disasterScenarioManageEntity.setProvinceId(disasterScenarioEntity.getProvinceId());
                    disasterScenarioManageEntity.setCity(disasterScenarioEntity.getCity());
                    disasterScenarioManageEntity.setCityId(disasterScenarioEntity.getCityId());
                    disasterScenarioManageEntity.setArea(disasterScenarioEntity.getArea());
                    disasterScenarioManageEntity.setAreaId(disasterScenarioEntity.getAreaId());
                    if (PlatformObjectUtils.isNotEmpty(disasterScenarioEntity.getArea())){
                        disasterScenarioManageService.save(disasterScenarioManageEntity);
                    }
                }
            }
        }
        return res;
    }


    @Override
    public DisasterScenarioEntity getDisasterScenarioData(ParamsVo params) {
        return disasterScenarioService.getDisasterScenarioData(params);
    }

    @Override
    public Boolean saveAnnualRisk(List<AnnualRiskEntity> list) throws UnsupportedEncodingException {
        List<AnnualRiskEntity> updateList = new ArrayList<>();
        List<AnnualRiskEntity> saveList = new ArrayList<>();
        Boolean res = false;
        if (!PlatformObjectUtils.isEmpty(list)) {
            for (int i = 0; i < list.size(); i++) {
                AnnualRiskEntity annualRiskEntity = list.get(i);
                //判断有没有id,没有id则保存,有id则更新
                if (PlatformObjectUtils.isEmpty(annualRiskEntity.getId())) {
                    saveList.add(annualRiskEntity);
                } else {
                    //判断id是否是分析表中.是则更新,不是则保存,有id可能是建议管理表中的数据
                    int count = annualRiskService.getCountById(annualRiskEntity.getId());
                    if (count == 0) {//不在分析表中
                        saveList.add(annualRiskEntity);
                    } else {
                        updateList.add(annualRiskEntity);
                    }
                }
            }
            for (AnnualRiskEntity annualRiskEntity : saveList) {
                res = annualRiskService.save(annualRiskEntity);
            }
            for (AnnualRiskEntity annualRiskEntity : updateList) {
                res = annualRiskService.update(annualRiskEntity);
            }
            for (AnnualRiskEntity annualRiskEntity : list) {
                AnnualRiskManageEntity annualRisjManageEntity = annualRiskManageService.getByProvinceCityCounty(annualRiskEntity.getProvinceId(), annualRiskEntity.getCityId(), annualRiskEntity.getAreaId());
                if (annualRisjManageEntity != null) {
                    annualRisjManageEntity.setBuilding(annualRiskEntity.getBuilding());
                    annualRisjManageEntity.setDisasterHiddenDanger(annualRiskEntity.getDisasterHiddenDanger());
                    annualRisjManageEntity.setLifelineSystem(annualRiskEntity.getLifelineSystem());
                    annualRisjManageEntity.setMajorInfrastructure(annualRiskEntity.getMajorInfrastructure());
                    annualRisjManageEntity.setOtherAnnualDisaster(annualRiskEntity.getOtherAnnualDisaster());
                    if (PlatformObjectUtils.isNotEmpty(annualRiskEntity.getArea())){
                        annualRiskManageService.update(annualRisjManageEntity);
                    }
                } else {
                    annualRisjManageEntity = new AnnualRiskManageEntity();
                    annualRisjManageEntity.setId(IdUtil.simpleUUID());
                    annualRisjManageEntity.setBuilding(annualRiskEntity.getBuilding());
                    annualRisjManageEntity.setDisasterHiddenDanger(annualRiskEntity.getDisasterHiddenDanger());
                    annualRisjManageEntity.setLifelineSystem(annualRiskEntity.getLifelineSystem());
                    annualRisjManageEntity.setMajorInfrastructure(annualRiskEntity.getMajorInfrastructure());
                    annualRisjManageEntity.setOtherAnnualDisaster(annualRiskEntity.getOtherAnnualDisaster());
                    annualRisjManageEntity.setDelFlag(YNEnum.N.toString());
                    annualRisjManageEntity.setCreateTime(new Date());
                    annualRisjManageEntity.setCreateId(PlatformSessionContext.getUserID());
                    annualRisjManageEntity.setUpdateId(PlatformSessionContext.getUserID());
                    annualRisjManageEntity.setUpdateTime(new Date());
                    annualRisjManageEntity.setProvince(annualRiskEntity.getProvince());
                    annualRisjManageEntity.setProvinceId(annualRiskEntity.getProvinceId());
                    annualRisjManageEntity.setCity(annualRiskEntity.getCity());
                    annualRisjManageEntity.setCityId(annualRiskEntity.getCityId());
                    if(!PlatformObjectUtils.isEmpty(annualRiskEntity.getAreaId())){
                        annualRisjManageEntity.setArea(annualRiskEntity.getArea());
                        annualRisjManageEntity.setAreaId(annualRiskEntity.getAreaId());
                    }
                    if (PlatformObjectUtils.isNotEmpty(annualRiskEntity.getArea())){
                        annualRiskManageService.save(annualRisjManageEntity);
                    }
                }
            }
        }
        return res;
    }

    @Override
    public AnnualRiskEntity getAnnualRiskData(ParamsVo params) {
        return annualRiskService.getAnnualRiskData(params);
    }

    @Override
    public Boolean saveEmergencyDisaster(List<EmergencyDisasterEntity> list) throws UnsupportedEncodingException {
        List<EmergencyDisasterEntity> updateList = new ArrayList<>();
        List<EmergencyDisasterEntity> saveList = new ArrayList<>();
        Boolean res = false;
        if (!PlatformObjectUtils.isEmpty(list)) {
            for (int i = 0; i < list.size(); i++) {
                EmergencyDisasterEntity emergencyDisasterEntity = list.get(i);
                //判断有没有id,没有id则保存,有id则更新
                if (PlatformObjectUtils.isEmpty(emergencyDisasterEntity.getId())) {
                    saveList.add(emergencyDisasterEntity);
                } else {
                    //判断id是否是分析表中.是则更新,不是则保存,有id可能是建议管理表中的数据
                    int count = emergencyDisasterService.getCountById(emergencyDisasterEntity.getId());
                    if (count == 0) {//不在分析表中
                        saveList.add(emergencyDisasterEntity);
                    } else {
                        updateList.add(emergencyDisasterEntity);
                    }
                }
            }
            for (EmergencyDisasterEntity emergencyDisasterEntity : saveList) {
                res = emergencyDisasterService.save(emergencyDisasterEntity);
            }
            for (EmergencyDisasterEntity emergencyDisasterEntity : updateList) {
                res = emergencyDisasterService.update(emergencyDisasterEntity);
            }
            for (EmergencyDisasterEntity emergencyDisasterEntity : list) {
                EmergencyDisasterManageEntity emergencyDisasterManageEntity = emergencyDisasterManageService.getByProvinceCityCounty(emergencyDisasterEntity.getProvinceId(), emergencyDisasterEntity.getCityId(), emergencyDisasterEntity.getAreaId());
                if (emergencyDisasterManageEntity != null) {
                    emergencyDisasterManageEntity.setEmergencySystem(emergencyDisasterEntity.getEmergencySystem());
                    emergencyDisasterManageEntity.setEmergencyWorkingMechanism(emergencyDisasterEntity.getEmergencyWorkingMechanism());
                    emergencyDisasterManageEntity.setEmergencySuppliesReserve(emergencyDisasterEntity.getEmergencySuppliesReserve());
                    emergencyDisasterManageEntity.setEmergencyRescueForce(emergencyDisasterEntity.getEmergencyRescueForce());
                    emergencyDisasterManageEntity.setEmergencyShelter(emergencyDisasterEntity.getEmergencyShelter());
                    emergencyDisasterManageEntity.setSupportability(emergencyDisasterEntity.getSupportability());
                    emergencyDisasterManageEntity.setRumorEmergencyCapacity(emergencyDisasterEntity.getRumorEmergencyCapacity());
                    emergencyDisasterManageEntity.setPopularization(emergencyDisasterEntity.getPopularization());
                    emergencyDisasterManageEntity.setOtherMeasures(emergencyDisasterEntity.getOtherMeasures());
                    if (PlatformObjectUtils.isNotEmpty(emergencyDisasterEntity.getArea())){
                        emergencyDisasterManageService.update(emergencyDisasterManageEntity);
                    }
                } else {
                    emergencyDisasterManageEntity = new EmergencyDisasterManageEntity();
                    emergencyDisasterManageEntity.setId(IdUtil.simpleUUID());
                    emergencyDisasterManageEntity.setEmergencySystem(emergencyDisasterEntity.getEmergencySystem());
                    emergencyDisasterManageEntity.setEmergencyWorkingMechanism(emergencyDisasterEntity.getEmergencyWorkingMechanism());
                    emergencyDisasterManageEntity.setEmergencySuppliesReserve(emergencyDisasterEntity.getEmergencySuppliesReserve());
                    emergencyDisasterManageEntity.setEmergencyRescueForce(emergencyDisasterEntity.getEmergencyRescueForce());
                    emergencyDisasterManageEntity.setEmergencyShelter(emergencyDisasterEntity.getEmergencyShelter());
                    emergencyDisasterManageEntity.setSupportability(emergencyDisasterEntity.getSupportability());
                    emergencyDisasterManageEntity.setRumorEmergencyCapacity(emergencyDisasterEntity.getRumorEmergencyCapacity());
                    emergencyDisasterManageEntity.setPopularization(emergencyDisasterEntity.getPopularization());
                    emergencyDisasterManageEntity.setOtherMeasures(emergencyDisasterEntity.getOtherMeasures());
                    emergencyDisasterManageEntity.setDelFlag(YNEnum.N.toString());
                    emergencyDisasterManageEntity.setCreateTime(new Date());
                    emergencyDisasterManageEntity.setCreateId(PlatformSessionContext.getUserID());
                    emergencyDisasterManageEntity.setUpdateId(PlatformSessionContext.getUserID());
                    emergencyDisasterManageEntity.setUpdateTime(new Date());
                    emergencyDisasterManageEntity.setProvince(emergencyDisasterEntity.getProvince());
                    emergencyDisasterManageEntity.setProvinceId(emergencyDisasterEntity.getProvinceId());
                    emergencyDisasterManageEntity.setCity(emergencyDisasterEntity.getCity());
                    emergencyDisasterManageEntity.setCityId(emergencyDisasterEntity.getCityId());
                    emergencyDisasterManageEntity.setArea(emergencyDisasterEntity.getArea());
                    emergencyDisasterManageEntity.setAreaId(emergencyDisasterEntity.getAreaId());
                    if (PlatformObjectUtils.isNotEmpty(emergencyDisasterEntity.getArea())){
                        emergencyDisasterManageService.save(emergencyDisasterManageEntity);
                    }
                }
            }
        }
        return res;
    }

    @Override
    public EmergencyDisasterEntity getEmergencyDisasterData(ParamsVo params) {
        return emergencyDisasterService.getEmergencyDisasterData(params);
    }

    @Override
    public Boolean saveEmergencyDisposal(List<EmergencyDisposalEntity> list) throws UnsupportedEncodingException {
        List<EmergencyDisposalEntity> updateList = new ArrayList<>();
        List<EmergencyDisposalEntity> saveList = new ArrayList<>();
        Boolean res = false;
        if (!PlatformObjectUtils.isEmpty(list)) {
            for (int i = 0; i < list.size(); i++) {
                EmergencyDisposalEntity emergencyDisposalEntity = list.get(i);
                //判断有没有id,没有id则保存,有id则更新
                if (PlatformObjectUtils.isEmpty(emergencyDisposalEntity.getId())) {
                    saveList.add(emergencyDisposalEntity);
                } else {
                    //判断id是否是分析表中.是则更新,不是则保存,有id可能是建议管理表中的数据
                    int count = emergencyDisposalService.getCountById(emergencyDisposalEntity.getId());
                    if (count == 0) {//不在分析表中
                        saveList.add(emergencyDisposalEntity);
                    } else {
                        updateList.add(emergencyDisposalEntity);
                    }
                }
            }
            for (EmergencyDisposalEntity emergencyDisposalEntity : saveList) {
                res = emergencyDisposalService.save(emergencyDisposalEntity);
            }
            for (EmergencyDisposalEntity emergencyDisposalEntity : updateList) {
                res = emergencyDisposalService.update(emergencyDisposalEntity);
            }
            for (EmergencyDisposalEntity emergencyDisposalEntity : list) {
                EmergencyDisposalManageEntity emergencyDisposalManageEntity = emergencyDisposalManageService.getByProvinceCityCounty(emergencyDisposalEntity.getProvinceId(), emergencyDisposalEntity.getCityId(), emergencyDisposalEntity.getAreaId());
                if (emergencyDisposalManageEntity != null) {
                    emergencyDisposalManageEntity.setRescueForceMaterialInput(emergencyDisposalEntity.getRescueForceMaterialInput());
                    emergencyDisposalManageEntity.setEarthquakeDisasterCriticalArea(emergencyDisposalEntity.getEarthquakeDisasterCriticalArea());
                    emergencyDisposalManageEntity.setTrafficSystemSupportRepair(emergencyDisposalEntity.getTrafficSystemSupportRepair());
                    emergencyDisposalManageEntity.setCommunicationsSystemSupportRepair(emergencyDisposalEntity.getCommunicationsSystemSupportRepair());
                    emergencyDisposalManageEntity.setPowerSystemSupportRepair(emergencyDisposalEntity.getPowerSystemSupportRepair());
                    emergencyDisposalManageEntity.setImportantFacilitiesCheck(emergencyDisposalEntity.getImportantFacilitiesCheck());
                    emergencyDisposalManageEntity.setClimateFeatureReply(emergencyDisposalEntity.getClimateFeatureReply());
                    emergencyDisposalManageEntity.setNationFeatureReply(emergencyDisposalEntity.getNationFeatureReply());
                    emergencyDisposalManageEntity.setRumorReply(emergencyDisposalEntity.getRumorReply());
                    emergencyDisposalManageEntity.setOtherFeatureReply(emergencyDisposalEntity.getOtherFeatureReply());
                    if (PlatformObjectUtils.isNotEmpty(emergencyDisposalEntity.getArea())){
                        emergencyDisposalManageService.update(emergencyDisposalManageEntity);
                    }

                } else {
                    emergencyDisposalManageEntity = new EmergencyDisposalManageEntity();
                    emergencyDisposalManageEntity.setId(IdUtil.simpleUUID());
                    emergencyDisposalManageEntity.setRescueForceMaterialInput(emergencyDisposalEntity.getRescueForceMaterialInput());
                    emergencyDisposalManageEntity.setEarthquakeDisasterCriticalArea(emergencyDisposalEntity.getEarthquakeDisasterCriticalArea());
                    emergencyDisposalManageEntity.setTrafficSystemSupportRepair(emergencyDisposalEntity.getTrafficSystemSupportRepair());
                    emergencyDisposalManageEntity.setCommunicationsSystemSupportRepair(emergencyDisposalEntity.getCommunicationsSystemSupportRepair());
                    emergencyDisposalManageEntity.setPowerSystemSupportRepair(emergencyDisposalEntity.getPowerSystemSupportRepair());
                    emergencyDisposalManageEntity.setImportantFacilitiesCheck(emergencyDisposalEntity.getImportantFacilitiesCheck());
                    emergencyDisposalManageEntity.setClimateFeatureReply(emergencyDisposalEntity.getClimateFeatureReply());
                    emergencyDisposalManageEntity.setNationFeatureReply(emergencyDisposalEntity.getNationFeatureReply());
                    emergencyDisposalManageEntity.setRumorReply(emergencyDisposalEntity.getRumorReply());
                    emergencyDisposalManageEntity.setOtherFeatureReply(emergencyDisposalEntity.getOtherFeatureReply());
                    emergencyDisposalManageEntity.setDelFlag(YNEnum.N.toString());
                    emergencyDisposalManageEntity.setCreateTime(new Date());
                    emergencyDisposalManageEntity.setCreateId(PlatformSessionContext.getUserID());
                    emergencyDisposalManageEntity.setUpdateId(PlatformSessionContext.getUserID());
                    emergencyDisposalManageEntity.setUpdateTime(new Date());
                    emergencyDisposalManageEntity.setProvince(emergencyDisposalEntity.getProvince());
                    emergencyDisposalManageEntity.setProvinceId(emergencyDisposalEntity.getProvinceId());
                    emergencyDisposalManageEntity.setCity(emergencyDisposalEntity.getCity());
                    emergencyDisposalManageEntity.setCityId(emergencyDisposalEntity.getCityId());
                    emergencyDisposalManageEntity.setArea(emergencyDisposalEntity.getArea());
                    emergencyDisposalManageEntity.setAreaId(emergencyDisposalEntity.getAreaId());
                    if (PlatformObjectUtils.isNotEmpty(emergencyDisposalEntity.getArea())){
                        emergencyDisposalManageService.save(emergencyDisposalManageEntity);
                    }
                }
            }
        }
        return res;
    }


    @Override
    public EmergencyDisposalEntity getEmergencyDisposalData(ParamsVo params) {
        return emergencyDisposalService.getEmergencyDisposalData(params);
    }

    @Override
    public Map<String, Object> getDataByTaskNum(String taskNum) {
        //灾害情景分析
        List<DisasterScenarioEntity> list1 = disasterScenarioService.getDisasterScenarioDataByTaskNum(taskNum);
        List<Map<String, Object>> disasterScenarioEntityList = new ArrayList<>();
        list1.forEach(disasterScenarioEntity -> {
            Map<String, Object> map = new HashMap<>();
            String city = disasterScenarioEntity.getCity();
            if (city.contains("北京市") || city.contains("天津市") || city.contains("上海市") || city.contains("重庆市")) {
                if (!PlatformObjectUtils.isEmpty(disasterScenarioEntity.getArea()) && !PlatformObjectUtils.isEmpty(disasterScenarioEntity.getAreaId())) {
                    DisasterScenarioEntity disasterScenarioCity = disasterScenarioService.getDisasterScenarioDataByTaskNum(taskNum, disasterScenarioEntity.getCityId(), disasterScenarioEntity.getAreaId());
                    map.put("areaName", disasterScenarioCity.getProvince() + disasterScenarioEntity.getArea());
                    map.put("buildingDamage", disasterScenarioCity.getBuildingDamage());
                    map.put("casualties", disasterScenarioCity.getCasualties());
                    map.put("geologicHazard", disasterScenarioCity.getGeologicHazard());
                    map.put("secondaryDisaster", disasterScenarioCity.getSecondaryDisaster());
                    map.put("earthquakeTraffic", disasterScenarioCity.getEarthquakeTraffic());
                    map.put("otherDisaster", disasterScenarioCity.getOtherDisaster());
                    map.put("maintainer", disasterScenarioCity.getMaintainer());
                    map.put("maintainTime", disasterScenarioCity.getMaintainTime());
                    disasterScenarioEntityList.add(map);
                }
            } else {
                map.put("areaName", disasterScenarioEntity.getProvince() + disasterScenarioEntity.getCity());
                map.put("buildingDamage", disasterScenarioEntity.getBuildingDamage());
                map.put("casualties", disasterScenarioEntity.getCasualties());
                map.put("geologicHazard", disasterScenarioEntity.getGeologicHazard());
                map.put("secondaryDisaster", disasterScenarioEntity.getSecondaryDisaster());
                map.put("earthquakeTraffic", disasterScenarioEntity.getEarthquakeTraffic());
                map.put("otherDisaster", disasterScenarioEntity.getOtherDisaster());
                map.put("maintainer", disasterScenarioEntity.getMaintainer());
                map.put("maintainTime", disasterScenarioEntity.getMaintainTime());
                disasterScenarioEntityList.add(map);
            }
        });

        //年度风险应对策略建议
        List<AnnualRiskEntity> list4 = annualRiskService.getAnnualRiskDataByTaskNum(taskNum);
        List<Map<String, Object>> annualRiskEntityList = new ArrayList<>();
        list4.forEach(annualRiskEntity -> {
            Map<String, Object> map = new HashMap<>();
            String city = annualRiskEntity.getCity();
            if (city.contains("北京市") || city.contains("天津市") || city.contains("上海市") || city.contains("重庆市")) {
                if (!PlatformObjectUtils.isEmpty(annualRiskEntity.getArea()) && !PlatformObjectUtils.isEmpty(annualRiskEntity.getAreaId())) {
                    AnnualRiskEntity annualRiskCity = annualRiskService.getAnnualRiskDataByTaskNum(taskNum, annualRiskEntity.getCityId(), annualRiskEntity.getAreaId());
                    map.put("areaName", annualRiskCity.getProvince() + annualRiskCity.getArea());
                    map.put("building", annualRiskCity.getBuilding());
                    map.put("disasterHiddenDanger", annualRiskCity.getDisasterHiddenDanger());
                    map.put("lifelineSystem", annualRiskCity.getLifelineSystem());
                    map.put("majorInfrastructure", annualRiskCity.getMajorInfrastructure());
                    map.put("otherAnnualDisaster", annualRiskCity.getOtherAnnualDisaster());
                    annualRiskEntityList.add(map);
                }
            } else {
                map.put("areaName", annualRiskEntity.getProvince() + annualRiskEntity.getCity());
                map.put("building", annualRiskEntity.getBuilding());
                map.put("disasterHiddenDanger", annualRiskEntity.getDisasterHiddenDanger());
                map.put("lifelineSystem", annualRiskEntity.getLifelineSystem());
                map.put("majorInfrastructure", annualRiskEntity.getMajorInfrastructure());
                map.put("otherAnnualDisaster", annualRiskEntity.getOtherAnnualDisaster());
                annualRiskEntityList.add(map);
            }
        });
        //应急备灾对策
        List<EmergencyDisasterEntity> list2 = emergencyDisasterService.getEmergencyDisasterDataByTaskNum(taskNum);
        List<Map<String, String>> emergencyDisasterEntityList = new ArrayList<>();
        list2.forEach(emergencyDisasterEntity -> {
            Map<String, String> map = new HashMap<>();
            String city = emergencyDisasterEntity.getCity();
            if (city.contains("北京市") || city.contains("天津市") || city.contains("上海市") || city.contains("重庆市")) {
                if (!PlatformObjectUtils.isEmpty(emergencyDisasterEntity.getArea()) && !PlatformObjectUtils.isEmpty(emergencyDisasterEntity.getAreaId())) {
                    EmergencyDisasterEntity emergencyDisasterCity = emergencyDisasterService.getEmergencyDisasterDataByTaskNum(taskNum, emergencyDisasterEntity.getCityId(), emergencyDisasterEntity.getAreaId());
                    map.put("areaName", emergencyDisasterCity.getProvince() + emergencyDisasterEntity.getArea());
                    map.put("emergencySystem", emergencyDisasterCity.getEmergencySystem());
                    map.put("emergencyWorkingMechanism", emergencyDisasterCity.getEmergencyWorkingMechanism());
                    map.put("emergencySuppliesReserve", emergencyDisasterCity.getEmergencySuppliesReserve());
                    map.put("emergencyRescueForce", emergencyDisasterCity.getEmergencyRescueForce());
                    map.put("emergencyShelter", emergencyDisasterCity.getEmergencyShelter());
                    map.put("supportability", emergencyDisasterCity.getSupportability());
                    map.put("rumorEmergencyCapacity", emergencyDisasterCity.getRumorEmergencyCapacity());
                    map.put("popularization", emergencyDisasterCity.getPopularization());
                    map.put("otherMeasures", emergencyDisasterCity.getOtherMeasures());
                    emergencyDisasterEntityList.add(map);
                }
            } else {
                map.put("areaName", emergencyDisasterEntity.getProvince() + emergencyDisasterEntity.getCity());
                map.put("emergencySystem", emergencyDisasterEntity.getEmergencySystem());
                map.put("emergencyWorkingMechanism", emergencyDisasterEntity.getEmergencyWorkingMechanism());
                map.put("emergencySuppliesReserve", emergencyDisasterEntity.getEmergencySuppliesReserve());
                map.put("emergencyRescueForce", emergencyDisasterEntity.getEmergencyRescueForce());
                map.put("emergencyShelter", emergencyDisasterEntity.getEmergencyShelter());
                map.put("supportability", emergencyDisasterEntity.getSupportability());
                map.put("rumorEmergencyCapacity", emergencyDisasterEntity.getRumorEmergencyCapacity());
                map.put("popularization", emergencyDisasterEntity.getPopularization());
                map.put("otherMeasures", emergencyDisasterEntity.getOtherMeasures());
                emergencyDisasterEntityList.add(map);
            }
        });
        //应急处置对策
        List<EmergencyDisposalEntity> list3 = emergencyDisposalService.getEmergencyDisposalDataByTaskNum(taskNum);
        List<Map<String, String>> emergencyDisposalEntityList = new ArrayList<>();
        list3.forEach(emergencyDisposalEntity -> {
            Map<String, String> map = new HashMap<>();
            String city = emergencyDisposalEntity.getCity();
            if (city.contains("北京市") || city.contains("天津市") || city.contains("上海市") || city.contains("重庆市")) {
                if (!PlatformObjectUtils.isEmpty(emergencyDisposalEntity.getArea()) && !PlatformObjectUtils.isEmpty(emergencyDisposalEntity.getAreaId())) {
                    EmergencyDisposalEntity emergencyDisposalCity = emergencyDisposalService.getEmergencyDisposalDataByTaskNum(taskNum, emergencyDisposalEntity.getCityId(), emergencyDisposalEntity.getAreaId());
                    map.put("areaName", emergencyDisposalCity.getProvince() + emergencyDisposalEntity.getArea());
                    map.put("rescueForceMaterialInput", emergencyDisposalCity.getRescueForceMaterialInput());
                    map.put("earthquakeDisasterCriticalArea", emergencyDisposalCity.getEarthquakeDisasterCriticalArea());
                    map.put("trafficSystemSupportRepair", emergencyDisposalCity.getTrafficSystemSupportRepair());
                    map.put("communicationsSystemSupportRepair", emergencyDisposalCity.getCommunicationsSystemSupportRepair());
                    map.put("powerSystemSupportRepair", emergencyDisposalCity.getPowerSystemSupportRepair());
                    map.put("importantFacilitiesCheck", emergencyDisposalCity.getImportantFacilitiesCheck());
                    map.put("climateFeatureReply", emergencyDisposalCity.getClimateFeatureReply());
                    map.put("nationFeatureReply", emergencyDisposalCity.getNationFeatureReply());
                    map.put("rumorReply", emergencyDisposalCity.getRumorReply());
                    map.put("otherFeatureReply", emergencyDisposalCity.getOtherFeatureReply());
                    emergencyDisposalEntityList.add(map);
                }
            } else {
                map.put("areaName", emergencyDisposalEntity.getProvince() + emergencyDisposalEntity.getCity());
                map.put("rescueForceMaterialInput", emergencyDisposalEntity.getRescueForceMaterialInput());
                map.put("earthquakeDisasterCriticalArea", emergencyDisposalEntity.getEarthquakeDisasterCriticalArea());
                map.put("trafficSystemSupportRepair", emergencyDisposalEntity.getTrafficSystemSupportRepair());
                map.put("communicationsSystemSupportRepair", emergencyDisposalEntity.getCommunicationsSystemSupportRepair());
                map.put("powerSystemSupportRepair", emergencyDisposalEntity.getPowerSystemSupportRepair());
                map.put("importantFacilitiesCheck", emergencyDisposalEntity.getImportantFacilitiesCheck());
                map.put("climateFeatureReply", emergencyDisposalEntity.getClimateFeatureReply());
                map.put("nationFeatureReply", emergencyDisposalEntity.getNationFeatureReply());
                map.put("rumorReply", emergencyDisposalEntity.getRumorReply());
                map.put("otherFeatureReply", emergencyDisposalEntity.getOtherFeatureReply());
                emergencyDisposalEntityList.add(map);
            }

        });
        Map<String, Object> map = new HashMap<>();
        map.put("zhqjfx", disasterScenarioEntityList);
        map.put("ndfxydcljy", annualRiskEntityList);//年度风险应对策略建议
        map.put("yjzbcz", emergencyDisasterEntityList);
        map.put("yjczdc", emergencyDisposalEntityList);
        return map;
    }

    @Override
    public Map<String, Object> getDataByTaskNum2(String taskNum) {
        //灾害情景分析
        List<DisasterScenarioEntity> list1 = disasterScenarioService.getDisasterScenarioDataByTaskNum(taskNum);
        //年度风险应对策略建议
        List<AnnualRiskEntity> list2 = annualRiskService.getAnnualRiskDataByTaskNum(taskNum);
        //应急备灾对策
        List<EmergencyDisasterEntity> list3 = emergencyDisasterService.getEmergencyDisasterDataByTaskNum(taskNum);
        //应急处置对策
        List<EmergencyDisposalEntity> list4 = emergencyDisposalService.getEmergencyDisposalDataByTaskNum(taskNum);
        Map<String, Object> map = new HashMap<>();
        map.put("zhqjfx", list1);
        map.put("ndfxydcljy", list2);
        map.put("yjbzdc", list3);
        map.put("yjczdc", list4);
        return map;
    }

}
